
execute_path=$(pwd)
echo ${execute_path}

export DEPLOY_MODE=0
export CKPT=$1
export EXP_NAME=$2
export RANK_SIZE=$3
RANK_START=$4


export TEMP_PATH=/home/liupan/temp/startrank${RANK_START}
export LOCAL_DEFAULT_PATH=$TEMP_PATH
export RANK_TABLE_FILE=/home/liupan/WingsofPanda/WP-GeneralPurposeMedicalFoundationModels/hccl/hccl_8p_01234567_127.0.1.1.json
# export RANK_TABLE_FILE=/home/yueyang/hccl_8p.json

DEVICE_START=0

source /usr/local/Ascend/driver/bin/setenv.bash
#rm -rf rank_*
rm -rf $TEMP_PATH/wpgeneralpurposemedicalfoundationmodels
rsync -rv --exclude-from=.copyignore $execute_path $TEMP_PATH
cd $TEMP_PATH/WP-GeneralPurposeMedicalFoundationModels || exit



for((i=0;i<=7;i++));
do
  export RANK_ID=$[i+RANK_START]
  export DEVICE_ID=$[i+DEVICE_START]
  echo "start validate for rank $RANK_ID, device $DEVICE_ID"
  python3 validate.py  --ckpt $CKPT --exp_name $EXP_NAME &
done
cd $execute_path || exit


# bash launch_validate.sh /data/output/mm_vitbaseall3d2dmodeall2nodeslr3mskr060/CKP-1024_101.ckpt validvitbaseall3d2dmodeall2nodeslr3mskr060 8 0